﻿using UnityEngine;

namespace UIFramework
{
    public class UIData
    {

    }

    /// <summary>
    /// UI对象基类
    /// </summary>
    public class UIBase : MonoBehaviour
    {
        public int ParentID;
        public int SelfID;

        /// <summary>
        /// 创建(实例化)时调用
        /// </summary>
        public virtual void Open(UIData uiData = null) 
        { 

        }

        /// <summary>
        /// 界面显示时调用
        /// </summary>
        public virtual void Show(UIData uiData = null)
        {
            gameObject.SetActive(true);
        }

        /// <summary>
        /// 界面隐藏时调用
        /// </summary>
        public virtual void Hide(UIData uiData = null)
        {
            gameObject.SetActive(false);
        }

        /// <summary>
        /// 销毁时调用
        /// </summary>
        public virtual void Close(UIData uiData = null)
        {
            Destroy(gameObject);
        }
    }
}